﻿#include "choosemap.h"
#include "ui_choosemap.h"

choosemap::choosemap(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::choosemap)
{
    setWindowTitle("选择地图");

    setWindowIcon(QIcon(":/RES/qqqqwwee.png"));


    ui->setupUi(this);
    this->setAutoFillBackground(true);
    // 创建调色板对象
    QPalette pi = this->palette();
    // 加载图片
    QPixmap pix(":/RES/download-file (4).jpg");
    pix=pix.scaled(1600,900);
    // 设置图片
    pi.setBrush(QPalette::Window, QBrush(pix));
    this->setPalette(pi);

}

choosemap::~choosemap()
{
    delete ui;
}

void choosemap::on_pushButton_3_clicked()
{
    this->hide();//隐藏该页面
    a.initialization(balitai);//对已经空参构造的游戏页面初始化
    gameover *g=new gameover;

    QObject::connect(&a,SIGNAL(over()),g,SLOT(last()));//实现页面跳转
    QObject::connect(&a,SIGNAL(back()),this,SLOT(last()));//实现页面跳转

    QObject::connect(g,SIGNAL(back()),this,SLOT(last()));//实现页面跳转

    QObject::connect(this,SIGNAL(to1()),&a,SLOT(last()));//链接到游戏页面的开始游戏槽函数
    emit to1();//激活信号
}
void choosemap::last()
{
    this->show();
}

void choosemap::on_pushButton_4_clicked()
{
    this->hide();
     a.initialization(jinnan);
    QObject::connect(this,SIGNAL(to2()),&a,SLOT(last()));
    QObject::connect(&a,SIGNAL(back()),this,SLOT(last()));//实现页面跳转


    emit to2();
}

void choosemap::on_pushButton_5_clicked()
{
    this->hide();
    a.initialization(taida);
    QObject::connect(this,SIGNAL(to3()),&a,SLOT(last()));
    QObject::connect(&a,SIGNAL(back()),this,SLOT(last()));//实现页面跳转

    emit to3();
}
